package cn.tedu.javagame.ball;

import java.awt.*;

public class Brick {
    int x,y;
    int width = 190,height = 60;
    Color color;
    public Brick(int x, int y) {
        this.x = x;
        this.y = y;
        int red = (int) (Math.random()*256);
        int green = (int) (Math.random()*256);
        int blue = (int) (Math.random()*256);
        this.color = new Color(red,green,blue);
    }
    public void hit() {
        // 每次被击中时缩小砖块
        this.width = Math.max(0, this.width - 76);
        this.height = Math.max(0, this.height - 24);
    }
}
